﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using QuocTeViet.DO;
using QuocTeViet.BL;
using System.Data;

namespace QuocTeViet.Module
{
    public partial class ucMennuNewsLeft : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                pnl.Visible = false;
                rptDichVuDataSource();
            }
        }

        protected void rptDichVuDataSource()
        {
            if (Request.QueryString["ID"] != null)
            {
                DataTable dtCategory = new DataTable("dtCategory");
                int ID = int.Parse(Request.QueryString["ID"].ToString());
                if (ID == 1)
                {
                    dtCategory = new cmsCategoryBL().SelectByParentID(ID, 0);
                    if ((dtCategory != null) && (dtCategory.Rows.Count > 0))
                    {
                        rptDichVu.DataSource = dtCategory;
                        rptDichVu.DataBind();
                        lblTitle.Text = "GIỚI THIỆU";
                        pnl.Visible = true;
                    }
                }
                else
                {
                     dtCategory = new cmsCategoryBL().SelectByParentID(4, 0);
                     if ((dtCategory != null) && (dtCategory.Rows.Count > 0))
                     {
                         rptDichVu.DataSource = dtCategory;
                         rptDichVu.DataBind();
                         lblTitle.Text = "DANH MỤC TIN TỨC";
                         pnl.Visible = true;
                     }
                }
            }

        }
        
        protected string FriendlyUrl(string s)
        {
            return Ultility.Change_AV(s);
        }
    }
}